package org.example.designPattern.structural.flyweight;

/*
* 享元模式：共享对象,避免创建大量的对象
* */
public class flyweightTest {
    public static void main(String[] args) {
        PersonInfo personInfo = new PersonInfo("json", "上海", 1);
        PersonInfo personInfo2 = new PersonInfo("alice", "上海", 6);
        PersonInfo personInfo3 = new PersonInfo("tom", "上海", 9);

        print(personInfo);
        print(personInfo2);
        print(personInfo3);
    }

    private static void print(PersonInfo personInfo) {
        CheckAddress checkAddress = new CheckAddress();
        System.out.println(String.format("当前人员核算检测信息：人员：%s 地址：%s 检测点：%s", personInfo.getUserName(), personInfo.getAddress(), checkAddress.getCheckAddress(personInfo.getCheckId())));
    }
}
